# coding=UTF-8
import time
import datetime
from datetime import datetime
import glob
################################################################################
# xml element variable define
def _init():
    glob._init()
    # xml element define
    global cmd_info_table
    cmd_info_table = [
        {'commandSource'    : '1'}, 
        {'sourceSystem'     : '4'}, 
        {'version'          : '1.0'}, 
        {'commandID'        : glob.command_id},
        {'operationType'    : '0'},         #0-增加; 1-删除
        {'level'            : '1'},         #1-高; 2-中; 3-低
        {'owner'            : 'owner123'},
        {'createTime'       : glob.now_time_str},
        {'effectTime'       : glob.beg_time_str},
        {'expiredTime'      : glob.end_time_str},
        ]
    
    global cmd_object_table
    cmd_object_table = [
        {'effectSystem'     : '4'}, 
        {'effectOperator'   : '02'}, 
        {'effectVendor'     : 'vendor123'},
        {'effectPovince'    : '0'},
        {'effectHouse'      : '1'},
        ]

    global cmd_result_table
    cmd_result_table = [
        {'handleType'       : '1'}, 
        {'reportType'       : '1'}, 
        {'reportCycle'      : '1'},
        ]

    # cmd_type_table(ignore)
    # 01: iot_evil_payload
    global iot_evil_payload_rule_table
    iot_evil_payload_rule_table = [
        [1, 'ruleID',           '1201160023041550'], 
        [1, 'eventType',        '011600'], 
        [1, 'startTime',        glob.beg_time_str], 
        [1, 'endTime',          glob.end_time_str], 
        [0, 'snortRule',
        'YWxlcnQgdGNwIGFueSBhbnkgLT4gYW55IGFueSAobXNnOiJFbWFpbCBEZXRlY3RlZCI7IGNvbnRlbnQ6IjY2NmRlY3J5cHQ2NjZAY29jay5saSI7IHNpZDoxMjAxMTYwMDIzMDQxNTUwOyByZXY6MTsp'], 
        [1, 'eventDirection',   '1'], 
        [1, 'isPcap',           '1'], 
    ]

    # 02: iot_evil_file
    global iot_evil_file_rule_table
    iot_evil_file_rule_table = [
        [1, 'ruleID',           '1201160023041550'], 
        [1, 'eventType',        '011600'], 
        [1, 'startTime',        glob.beg_time_str], 
        [1, 'endTime',          glob.end_time_str], 
        [0, 'destIp',           '1.1.1.1'], 
        [0, 'url',              'http://www.baiud.com'], 
        [0, 'domain',           'www.baidu.com'], 
        [0, 'sampleMd5List',
        'e84a902b2300a7dc19d834259842a669,fe850a6c98438612dcee23df2150030d,6d21c44a2377fc871ae00106e4a0a3b7,bfa8d66509e07faba724dc0f9035c0d3,9f7c2eadf73062aa7f330a4b8832309a,e1688a3cc514ccb7b714542487eadf7d,4ccf98d506acf6396e893bcb6436d8e6'], 
        [0, 'yaraDescription',  'eWFyYURlc2NyaXB0aW9u6KeE5YiZ'], 
        [1, 'isUploadFile',     '1'], 
    ]

    # 03: iot_data_select
    global iot_data_select_rule_table
    iot_data_select_rule_table = [
        [1, 'ruleId',           '1201160023041550'], 
        [1, 'portGroup',        '011600'], 
        [1, 'iotBase',          '011600'], 
        [0, 'iotProvince',      '011600'], 
        [1, 'ruleType',         '011600'], 
        [0, 'sip',              '1.1.1.1'], 
        [0, 'sipMask',          '24'], 
        [0, 'dip',              '2.1.1.1'], 
        [0, 'dipMask',          '24'], 
        [0, 'sport',            '10000'], 
        [0, 'sportMask',        '5'], 
        [0, 'dport',            '20000'], 
        [0, 'dportMask',        '5'], 
        [0, 'protocol',         '1'], 
        [0, 'udValue',          'udvalue123'], 
        [0, 'offset',           '3'], 
        [0, 'host',             'www.baidu.com'], 
        [0, 'sni',              'sni123'], 
        [0, 'clientIp',         '3.1.1.1'], 
        [0, 'serverIp',         '4.1.1.1'], 
        [0, 'serverPort',       '30000'], 
        [0, 'IMEI',             '869161029912920'], 
        [0, 'apn',              'iot.mmc004.gps'], 
        [1, 'startTime',        glob.beg_time_str], 
        [1, 'endTime',          glob.end_time_str], 
    ]
